package Interface.Producao.Inco;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

//esta class realiza a leitura do arquivo e retorna uma lista de String[];
public class LerInconsistencia {
    public static LerInconsistencia instance = null;

    public LerInconsistencia() {
    }
    
    public static LerInconsistencia getInstance(){
        if(instance == null){
            instance = new LerInconsistencia();
        }
        return instance;
    }
    
    private List<String[]> list = new ArrayList<>();

    public List<String[]> lerAquivo(String filename) {
        try {
            FileReader file = new FileReader(filename);
            BufferedReader buff = new BufferedReader(file);
            String readLine = buff.readLine();

            while (readLine != null) {

                list.add(readLine.split("\t"));
                readLine = buff.readLine();
            }

        } catch (FileNotFoundException ex) {
            System.out.println("Erro: " + ex);
        } catch (IOException ex) {
            System.out.println("Erro: " + ex);
        }
        return list;
    }
}
